using _4_NovaAdmin.Web.Core.Middlewares;
using _4_NovaAdmin.Web.Core.ServiceExtensions;
using _5_NovaAdmin.Infrastructure.Extensions;

namespace _1_NovaAdmin.Web.Entry
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);
            // Add services to the container.
            builder.LoadJsonConfig();
            builder.Services.AddControllersWithViews();
            var config = builder.Configuration;
            builder.Services.AddServices(config);

            var app = builder.Build();

            MigrationHandler.CreateEntities(args, app);
            //// Configure the HTTP request pipeline.
            if (!app.Environment.IsDevelopment())
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
                app.UseHttpsRedirection();
            }
            app.AddConfigure(config);
            app.Run();
        }
    }
}
